While it is possible to access a global variable or function without using the ::
operator, it can be considered to be misleading
because it might imply to the readers of your code that this is a local or class variable/function and not a global one. Being explicit also allows
more freedom in naming local variables without the chance of clashing with global names.
Noncompliant code example
int a = 10;
int main()
{
...
int b = a; // Noncompliant
...
}
Compliant solution
int a = 10;
int main()
{
...
int b = ::a; // Compliant
...
}